package com.goods.business.converter;

import com.goods.common.model.business.Health;
import com.goods.common.vo.business.HealthVO;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

public class HealthConverter {
    public static List<HealthVO> converterToHealthVOList(List<Health> healthList) {
        if (!CollectionUtils.isEmpty(healthList)){
            List<HealthVO> healthVOS = new ArrayList<>();
            for (Health health : healthList) {
                HealthVO healthVO = new HealthVO();
                BeanUtils.copyProperties(health,healthVO);
                healthVO.setUserId(health.getUserId());
                healthVOS.add(healthVO);
            }
            return healthVOS;
        }
        return null;
    }
}
